﻿<script>
    jQuery().ready(function(){
        // 营销预付款单
        var fieldIdXb = WfForm.convertFieldNameToId("sfhtbz");

        changeDetails();

        WfForm.registerAction(WfForm.ACTION_ADDROW+"1", function(index){
            changeDetails();
        });
        WfForm.registerAction(WfForm.ACTION_DELROW+"1", function(arg){
            changeDetails();
        });
        WfForm.registerAction(WfForm.ACTION_EDITDETAILROW+"1", function(arg){
            changeDetails();
        });
        WfForm.registerAction(WfForm.ACTION_SWITCHDETAILPAGING, function(groupid){
            changeDetails();
        });
        WfForm.registerAction(WfForm.ACTION_SWITCHTABLAYOUT, function(tabid){
            changeDetails();
        });

        WfForm.bindFieldChangeEvent(fieldIdXb, function (obj, id, value) {
            window.setTimeout(function () {
                if (value == 0) {
                    jQuery(".pz_class_1").removeClass("detail_hide_col");
                    jQuery(".pz_class_2").removeClass("detail_hide_col");
                    jQuery(".pz_class_3").removeClass("detail_hide_col");
                    jQuery(".pz_class_4").removeClass("detail_hide_col");
                    jQuery(".pz_class_5").removeClass("detail_hide_col");
                    jQuery(".pz_class_6").removeClass("detail_hide_col");
                } else if (value == 1) {
                    jQuery(".pz_class_1").addClass("detail_hide_col");
                    jQuery(".pz_class_2").addClass("detail_hide_col");
                    jQuery(".pz_class_3").addClass("detail_hide_col");
                    jQuery(".pz_class_4").addClass("detail_hide_col");
                    jQuery(".pz_class_5").addClass("detail_hide_col");
                    jQuery(".pz_class_6").addClass("detail_hide_col");
                }
                if (value == null || value == "") {
                    jQuery(".pz_class_1").removeClass("detail_hide_col");
                    jQuery(".pz_class_2").removeClass("detail_hide_col");
                    jQuery(".pz_class_3").removeClass("detail_hide_col");
                    jQuery(".pz_class_4").removeClass("detail_hide_col");
                    jQuery(".pz_class_5").removeClass("detail_hide_col");
                    jQuery(".pz_class_6").removeClass("detail_hide_col");
                }
            }, 10);
        });
    });

    function changeDetails(){
        var fieldIdXb = WfForm.convertFieldNameToId("sfhtbz");
        var fieldvaluez = WfForm.getFieldValue(fieldIdXb);

        if (fieldvaluez == 1) {
            jQuery(".pz_class_1").addClass("detail_hide_col");
            jQuery(".pz_class_2").addClass("detail_hide_col");
            jQuery(".pz_class_3").addClass("detail_hide_col");
            jQuery(".pz_class_4").addClass("detail_hide_col");
            jQuery(".pz_class_5").addClass("detail_hide_col");
            jQuery(".pz_class_6").addClass("detail_hide_col");
        }else {
            jQuery(".pz_class_1").removeClass("detail_hide_col");
            jQuery(".pz_class_2").removeClass("detail_hide_col");
            jQuery(".pz_class_3").removeClass("detail_hide_col");
            jQuery(".pz_class_4").removeClass("detail_hide_col");
            jQuery(".pz_class_5").removeClass("detail_hide_col");
            jQuery(".pz_class_6").removeClass("detail_hide_col");
        }
    }
</script>